import { get, post, del, put } from "@/utils/request"

export interface PetWeight {
    id: number, // 体重记录id
    petId: number, // 宠物id
    weight: number, // 宠物体重
    recordDate: string, // 记录时间
    remark: string, // 备注
}

export function emptyPetWeight() {
    return {
        id: 0,
        petId: 0,
        weight: 0,
        recordDate: new Date().toISOString().slice(0, 10),
        remark: ''
    };
}

export function listPetWeight(id: number) {
    return get<PetWeight[]>(`/api/pet/weight/list/${id}`)
}

export function addPetWeight(data: PetWeight) {
    return post("/api/pet/weight/add", data)
}

export function updatePetWeight(data: PetWeight) {
    return put("/api/pet/weight/update", data)
}

export function deletePetWeight(id: number, petId: number) {
    return del(`/api/pet/weight/delete/${id}`, { petId })
}
